package com.jweb.framework.ws.soap.axiom;

import java.io.IOException;
import java.io.InputStream;

import javax.activation.DataHandler;

import org.springframework.util.Assert;
import org.springframework.ws.mime.Attachment;

/**
 * 修改人： Thomas
 * 修改内容：新增 
 * 类说明：Axiom-specific implementation of {@link org.springframework.ws.mime.Attachment}
 */
public class AxiomAttachment implements Attachment{
	
	private final DataHandler dataHandler ;
	
	private final String contentId ;
	
	public AxiomAttachment(String contentId , DataHandler dataHandler) {
		Assert.notNull(contentId , "contentId must not be null");
		Assert.notNull(dataHandler , "dataHandler must not be null");
		this.contentId = contentId ;
		this.dataHandler = dataHandler ;
	}
	
	public String getContentId(){
		return contentId ;
	}
	
	public String getContentType(){
		return dataHandler.getContentType();
	}
	
	public InputStream getInputStream() throws IOException {
		return dataHandler.getInputStream();
	}
	
	public long getSize(){
		return -1 ;
	}
	
	public DataHandler getDataHandler(){
		return dataHandler ; 
	}
	
}
